<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="robots" content="noodp" />
        <title>长度最小的子数组 - 欢迎来到SY的博客</title><meta name="description" content="长度最小的子数组"><meta property="og:title" content="长度最小的子数组" />
<meta property="og:description" content="长度最小的子数组" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" /><meta property="og:image" content="https://acking-you.gitee.io/logo.png"/><meta property="article:section" content="posts" />
<meta property="article:published_time" content="2022-08-16T00:00:00+00:00" />
<meta property="article:modified_time" content="2022-08-16T00:00:00+00:00" />

<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="https://acking-you.gitee.io/logo.png"/>

<meta name="twitter:title" content="长度最小的子数组"/>
<meta name="twitter:description" content="长度最小的子数组"/>
<meta name="application-name" content="FeelIt">
<meta name="apple-mobile-web-app-title" content="FeelIt"><meta name="theme-color" content="#ffffff"><meta name="msapplication-TileColor" content="#da532c"><link rel="canonical" href="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" /><link rel="prev" href="https://acking-you.gitee.io/posts/%C3%A4%C2%BA%C3%A5%C3%A6%C3%A6/" /><link rel="next" href="https://acking-you.gitee.io/posts/%C3%A5%C3%A5%C3%A5%C3%A7%C3%A5%C3%A5%C3%A7%C3%A8%C3%A5/" /><link rel="stylesheet" href="/css/page.min.css"><link rel="stylesheet" href="/css/home.min.css"><script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "BlogPosting",
        "headline": "长度最小的子数组",
        "inLanguage": "zh-CN",
        "mainEntityOfPage": {
            "@type": "WebPage",
            "@id": "https:\/\/acking-you.gitee.io\/posts\/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7\/"
        },"genre": "posts","keywords": "长度最小的子数组","wordcount":  1449 ,
        "url": "https:\/\/acking-you.gitee.io\/posts\/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7\/","datePublished": "2022-08-16T00:00:00+00:00","dateModified": "2022-08-16T00:00:00+00:00","publisher": {
            "@type": "Organization",
            "name": "作者"},"author": {
                "@type": "Person",
                "name": "作者"
            },"description": "长度最小的子数组"
    }
    </script></head><body data-header-desktop="auto" data-header-mobile="auto"><script>(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('auto' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : 'auto' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>

        <div id="mask"></div><div class="wrapper"><header class="desktop" id="header-desktop">
    <div class="header-wrapper">
        <div class="header-title">
            <a href="/" title="欢迎来到SY的博客">欢迎来到SY的博客</a>
        </div>
        <div class="menu">
            <div class="menu-inner"><a class="menu-item" href="/posts/"> 文章 </a><a class="menu-item" href="/tags/"> 标签 </a><a class="menu-item" href="/categories/"> 分类 </a><span class="menu-item delimiter"></span><span class="menu-item search" id="search-desktop">
                        <input type="text" placeholder="搜索文章标题或内容..." id="search-input-desktop">
                        <a href="#" class="search-button search-toggle" id="search-toggle-desktop" title="搜索">
                            <i class="fas fa-search fa-fw"></i>
                        </a>
                        <a href="#" class="search-button search-clear" id="search-clear-desktop" title="清空">
                            <i class="fas fa-times-circle fa-fw"></i>
                        </a>
                        <span class="search-button search-loading" id="search-loading-desktop">
                            <i class="fas fa-spinner fa-fw fa-spin"></i>
                        </span>
                    </span><a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                    <i class="fas fa-adjust fa-fw"></i>
                </a>
            </div>
        </div>
    </div>
</header><header class="mobile" id="header-mobile">
    <div class="header-container">
        <div class="header-wrapper">
            <div class="header-title">
                <a href="/" title="欢迎来到SY的博客">欢迎来到SY的博客</a>
            </div>
            <div class="menu-toggle" id="menu-toggle-mobile">
                <span></span><span></span><span></span>
            </div>
        </div>
        <div class="menu" id="menu-mobile"><div class="search-wrapper">
                    <div class="search mobile" id="search-mobile">
                        <input type="text" placeholder="搜索文章标题或内容..." id="search-input-mobile">
                        <a href="#" class="search-button search-toggle" id="search-toggle-mobile" title="搜索">
                            <i class="fas fa-search fa-fw"></i>
                        </a>
                        <a href="#" class="search-button search-clear" id="search-clear-mobile" title="清空">
                            <i class="fas fa-times-circle fa-fw"></i>
                        </a>
                        <span class="search-button search-loading" id="search-loading-mobile">
                            <i class="fas fa-spinner fa-fw fa-spin"></i>
                        </span>
                    </div>
                    <a href="#" class="search-cancel" id="search-cancel-mobile">
                        取消
                    </a>
                </div><a class="menu-item" href="/posts/" title="">文章</a><a class="menu-item" href="/tags/" title="">标签</a><a class="menu-item" href="/categories/" title="">分类</a><div class="menu-item"><a href="javascript:void(0);" class="theme-switch" title="切换主题">
                    <i class="fas fa-adjust fa-fw"></i>
                </a>
            </div></div>
    </div>
</header><div class="search-dropdown desktop">
    <div id="search-dropdown-desktop"></div>
</div>
<div class="search-dropdown mobile">
    <div id="search-dropdown-mobile"></div>
</div><main class="main">
                <div class="container"><div class="toc" id="toc-auto">
            <h2 class="toc-title">目录</h2>
            <div class="toc-content" id="toc-content-auto"></div>
        </div><article class="page single" data-toc="disable"><div class="featured-image"><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://img-blog.csdnimg.cn/img_convert/385f4cc39feda8590ef42f86b38207ba.png#pic_center"
        data-srcset="https://img-blog.csdnimg.cn/img_convert/385f4cc39feda8590ef42f86b38207ba.png#pic_center, https://img-blog.csdnimg.cn/img_convert/385f4cc39feda8590ef42f86b38207ba.png#pic_center 1.5x, https://img-blog.csdnimg.cn/img_convert/385f4cc39feda8590ef42f86b38207ba.png#pic_center 2x"
        data-sizes="auto"
        alt="https://img-blog.csdnimg.cn/img_convert/385f4cc39feda8590ef42f86b38207ba.png#pic_center"
        title="长度最小的子数组" /></div><div class="single-card" data-image="true"><h2 class="single-title animated flipInX">长度最小的子数组</h2><div class="post-meta">
                <div class="post-meta-line"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>作者</a></span>&nbsp;<span class="post-category">出版于  <a href="/categories/%E7%AE%97%E6%B3%95%E7%9A%84%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0/"><i class="far fa-folder fa-fw"></i>算法的深度学习</a></span></div>
                <div class="post-meta-line"><span><i class="far fa-calendar-alt fa-fw"></i>&nbsp;<time datetime="2022-08-16">2022-08-16</time></span>&nbsp;<span><i class="fas fa-pencil-alt fa-fw"></i>&nbsp;约 1449 字</span>&nbsp;
                    <span><i class="far fa-clock fa-fw"></i>&nbsp;预计阅读 3 分钟</span>&nbsp;</div>
            </div>
            
            <hr><div class="details toc" id="toc-static"  data-kept="">
                    <div class="details-summary toc-title">
                        <span>目录</span>
                        <span><i class="details-icon fas fa-angle-right"></i></span>
                    </div>
                    <div class="details-content toc-content" id="toc-content-static"><nav id="TableOfContents">
  <ul>
    <li><a href="#长度最小的子数组">长度最小的子数组</a></li>
    <li><a href="#思路">思路</a></li>
    <li><a href="#暴力解法">暴力解法</a></li>
    <li><a href="#滑动窗口">滑动窗口</a></li>
    <li><a href="#滑动窗口相关练习题目">滑动窗口相关练习题目</a></li>
  </ul>
</nav></div>
                </div><div class="content" id="content"><h2 id="长度最小的子数组">长度最小的子数组</h2>
<p><a href="https://leetcode.cn/problems/minimum-size-subarray-sum/" target="_blank" rel="noopener noreffer">力扣题目链接</a></p>
<p>给定一个含有n个正整数的数组和一个正整数target，找出该数组中满足其和&gt;=target的长度最小的连续子数组，并返回其长度。如果不存在符合要求的子数组，返回0。</p>
<p>示例：</p>
<p>输入：target=7，nums=[2,3,1,2,4,3]，输出2。</p>
<p>解释：子数组[4,3]是该条件的长度最小子数组。</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://raw.githubusercontent.com/jjking20010901/typora/master/img202208161055807.png"
        data-srcset="https://raw.githubusercontent.com/jjking20010901/typora/master/img202208161055807.png, https://raw.githubusercontent.com/jjking20010901/typora/master/img202208161055807.png 1.5x, https://raw.githubusercontent.com/jjking20010901/typora/master/img202208161055807.png 2x"
        data-sizes="auto"
        alt="https://raw.githubusercontent.com/jjking20010901/typora/master/img202208161055807.png"
        title="image-20220816105546757" /></p>
<h2 id="思路">思路</h2>
<p>该题有两种解决方法，第一种是暴力解法，通过两层for循环，然后不断寻找符合条件的子序列。另一种方法是滑动窗口，下面我就详细讲解这两种方法。</p>
<h2 id="暴力解法">暴力解法</h2>
<p>这道题目的暴力解法当然是两层for循环，然后不断寻找符合条件的子序列，时间复杂度明显是O(n^2)。</p>
<p>代码如下：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-CPP" data-lang="CPP"><span class="k">class</span> <span class="nc">Solution</span> <span class="p">{</span>
<span class="k">public</span><span class="o">:</span>
    <span class="kt">int</span> <span class="n">minSubArrayLen</span><span class="p">(</span><span class="kt">int</span> <span class="n">s</span><span class="p">,</span> <span class="n">vector</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;&amp;</span> <span class="n">nums</span><span class="p">)</span> <span class="p">{</span>
        <span class="kt">int</span> <span class="n">result</span> <span class="o">=</span> <span class="n">INT32_MAX</span><span class="p">;</span> <span class="c1">// 最终的结果
</span><span class="c1"></span>        <span class="kt">int</span> <span class="n">sum</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="c1">// 子序列的数值之和
</span><span class="c1"></span>        <span class="kt">int</span> <span class="n">subLength</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="c1">// 子序列的长度
</span><span class="c1"></span>        <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">nums</span><span class="p">.</span><span class="n">size</span><span class="p">();</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// 设置子序列起点为i
</span><span class="c1"></span>            <span class="n">sum</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
            <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">j</span> <span class="o">=</span> <span class="n">i</span><span class="p">;</span> <span class="n">j</span> <span class="o">&lt;</span> <span class="n">nums</span><span class="p">.</span><span class="n">size</span><span class="p">();</span> <span class="n">j</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// 设置子序列终止位置为j
</span><span class="c1"></span>                <span class="n">sum</span> <span class="o">+=</span> <span class="n">nums</span><span class="p">[</span><span class="n">j</span><span class="p">];</span>
                <span class="k">if</span> <span class="p">(</span><span class="n">sum</span> <span class="o">&gt;=</span> <span class="n">s</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// 一旦发现子序列和超过了s，更新result
</span><span class="c1"></span>                    <span class="n">subLength</span> <span class="o">=</span> <span class="n">j</span> <span class="o">-</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span> <span class="c1">// 取子序列的长度
</span><span class="c1"></span>                    <span class="n">result</span> <span class="o">=</span> <span class="n">result</span> <span class="o">&lt;</span> <span class="n">subLength</span> <span class="o">?</span> <span class="nl">result</span> <span class="p">:</span> <span class="n">subLength</span><span class="p">;</span>
                    <span class="k">break</span><span class="p">;</span> <span class="c1">// 因为我们是找符合条件最短的子序列，所以一旦符合条件就break
</span><span class="c1"></span>                <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">}</span>
        <span class="c1">// 如果result没有被赋值的话，就返回0，说明没有符合条件的子序列
</span><span class="c1"></span>        <span class="k">return</span> <span class="n">result</span> <span class="o">==</span> <span class="n">INT32_MAX</span> <span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="n">result</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>
</code></pre></div><ul>
<li>时间复杂度为O(n^2)。</li>
<li>空间复杂度为O(1)。</li>
</ul>
<h2 id="滑动窗口">滑动窗口</h2>
<p>接下来就开始介绍数组操作中另外一个重要方法：<strong>滑动窗口。</strong></p>
<p>所谓滑动窗口，<strong>就是不断的调节子序列的起始位置和终止位置，从而得出我们想要的结果。</strong></p>
<p>在暴力解法中，是一个for循环为滑动窗口的起始位置，一个for循环为滑动窗口的终止位置，用两个for循环完成一个不断搜索区间的过程。</p>
<p>那么我们如何通过滑动窗口使用一个for循环完成这个操作呢？</p>
<p>首先我们得思考如果用一个for循环，那么应该表示滑动窗口的起始位置，还是终止位置？</p>
<p>如果只用一个for循环来表示滑动窗口的起始位置，那么如何遍历剩下的终止位置？</p>
<p>若只用一个for循环，那么这个for循环中的索引一定表示滑动窗口的终止位置，那么，滑动窗口的起始位置如何移动？</p>
<p>其实我们可以将滑动窗口理解为双指针法中的一种。只不过滑动窗口更像一个窗口的移动，所以叫做滑动窗口。</p>
<p>在本题中实现滑动窗口，主要确定如下三点：</p>
<ul>
<li>
<p>窗口内是什么？</p>
</li>
<li>
<p>如何移动窗口的起始位置？</p>
</li>
<li>
<p>如何移动窗口的结束位置？</p>
</li>
</ul>
<p>在本题中，窗口就是满足其和&gt;=target的长度最小的连续子数组。</p>
<p>窗口的起始位置如何移动：如果当前窗口的值大于target，窗口就要向前移动了。</p>
<p>窗口的结束位置如何移动：窗口的结束位置就是遍历数组的指针，也就是for循环中的索引。</p>
<p>滑动窗口的精妙之处在于根据当前子序列和大小的情况，不断调节子序列的起始位置。从而将O(n^2)的暴力解法降为O(n)的滑动窗口。</p>
<p>代码如下：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-CPP" data-lang="CPP"><span class="k">class</span> <span class="nc">Solution</span> <span class="p">{</span>
<span class="k">public</span><span class="o">:</span>
    <span class="kt">int</span> <span class="n">minSubArrayLen</span><span class="p">(</span><span class="kt">int</span> <span class="n">target</span><span class="p">,</span> <span class="n">vector</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;&amp;</span> <span class="n">nums</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">//定义一个无穷大的数
</span><span class="c1"></span>        <span class="kt">int</span> <span class="n">result</span><span class="o">=</span><span class="mi">99999999</span><span class="p">;</span>
        <span class="c1">//滑动窗口数值之和
</span><span class="c1"></span>        <span class="kt">int</span> <span class="n">sum</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
        <span class="c1">//滑动窗口的起始位置
</span><span class="c1"></span>        <span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
        <span class="c1">//滑动窗口的长度
</span><span class="c1"></span>        <span class="kt">int</span> <span class="n">subLength</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
        <span class="k">for</span><span class="p">(</span><span class="kt">int</span> <span class="n">j</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="n">j</span><span class="o">&lt;</span><span class="n">nums</span><span class="p">.</span><span class="n">size</span><span class="p">();</span><span class="n">j</span><span class="o">++</span><span class="p">)</span>
        <span class="p">{</span>
            <span class="n">sum</span><span class="o">+=</span><span class="n">nums</span><span class="p">[</span><span class="n">j</span><span class="p">];</span>
            <span class="c1">//每次更新滑动窗口的起始位置，并不断比较子序列是否符合条件
</span><span class="c1"></span>            <span class="k">while</span><span class="p">(</span><span class="n">sum</span><span class="o">&gt;=</span><span class="n">target</span><span class="p">)</span>
            <span class="p">{</span>
                <span class="c1">//获取子序列的长度
</span><span class="c1"></span>                <span class="n">subLength</span><span class="o">=</span><span class="n">j</span><span class="o">-</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">;</span>
                <span class="c1">//获取符合要求的子序列长度
</span><span class="c1"></span>                <span class="n">result</span><span class="o">=</span><span class="n">result</span> <span class="o">&lt;</span> <span class="n">subLength</span> <span class="o">?</span> <span class="nl">result</span> <span class="p">:</span> <span class="n">subLength</span><span class="p">;</span>
                <span class="c1">//滑动窗口的精髓:不断变更起始位置
</span><span class="c1"></span>                <span class="n">sum</span><span class="o">-=</span><span class="n">nums</span><span class="p">[</span><span class="n">i</span><span class="o">++</span><span class="p">];</span>
            <span class="p">}</span>
        <span class="p">}</span>
        <span class="c1">//未找到子序列长度返回0
</span><span class="c1"></span>        <span class="k">return</span> <span class="n">result</span> <span class="o">==</span><span class="mi">99999999</span> <span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="n">result</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>
</code></pre></div><p>有些人会问为什么滑动窗口的时间复杂度为O(n)？</p>
<p>不要以为for循环里面放了一个while循环就以为时间复杂度就是O(n^2)。主要看每一个元素被操作的次数，每一元素在滑动窗口后进来操作一次，出去操作一次，每个元素是被操作两次，所以时间复杂度为O(n)。</p>
<h2 id="滑动窗口相关练习题目">滑动窗口相关练习题目</h2>
<p><a href="https://leetcode.cn/problems/fruit-into-baskets/" target="_blank" rel="noopener noreffer">LeetCode 904、水果成篮</a></p>
<p><a href="https://leetcode.cn/problems/minimum-window-substring/" target="_blank" rel="noopener noreffer">LeetCode 76、最小覆盖子串</a></p>
</div><div class="post-footer" id="post-footer">
    <div class="post-info"><div class="post-info-tag"><span><a href="/tags/%E9%95%BF%E5%BA%A6%E6%9C%80%E5%B0%8F%E7%9A%84%E5%AD%90%E6%95%B0%E7%BB%84/">长度最小的子数组</a>
                </span></div><div class="post-info-line"><div class="post-info-mod">
                <span>更新于 2022-08-16</span>
            </div><div class="post-info-mod"></div>
        </div><div class="post-info-share">
            <span><a href="javascript:void(0);" title="分享到 Twitter" data-sharer="twitter" data-url="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" data-title="长度最小的子数组" data-hashtags="长度最小的子数组"><i class="fab fa-twitter fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Facebook" data-sharer="facebook" data-url="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" data-hashtag="长度最小的子数组"><i class="fab fa-facebook-square fa-fw"></i></a><a href="javascript:void(0);" title="分享到 WhatsApp" data-sharer="whatsapp" data-url="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" data-title="长度最小的子数组" data-web><i class="fab fa-whatsapp fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Line" data-sharer="line" data-url="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" data-title="长度最小的子数组"><i class="fab fa-line fa-fw"></i></a><a href="javascript:void(0);" title="分享到 微博" data-sharer="weibo" data-url="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" data-title="长度最小的子数组" data-image="https://img-blog.csdnimg.cn/img_convert/385f4cc39feda8590ef42f86b38207ba.png#pic_center"><i class="fab fa-weibo fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Myspace" data-sharer="myspace" data-url="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" data-title="长度最小的子数组" data-description="长度最小的子数组"><i data-svg-src="/lib/simple-icons/icons/myspace.min.svg"></i></a><a href="javascript:void(0);" title="分享到 Blogger" data-sharer="blogger" data-url="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" data-title="长度最小的子数组" data-description="长度最小的子数组"><i class="fab fa-blogger fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Evernote" data-sharer="evernote" data-url="https://acking-you.gitee.io/posts/%C3%A9%C3%A5%C2%BA%C3%A6%C3%A5%C3%A7%C3%A5%C3%A6%C3%A7/" data-title="长度最小的子数组"><i class="fab fa-evernote fa-fw"></i></a></span>
        </div></div><div class="post-nav"><a href="/posts/%C3%A4%C2%BA%C3%A5%C3%A6%C3%A6/" class="prev" rel="prev" title="二分查找"><i class="fas fa-angle-left fa-fw"></i>Previous Post</a>
            <a href="/posts/%C3%A5%C3%A5%C3%A5%C3%A7%C3%A5%C3%A5%C3%A7%C3%A8%C3%A5/" class="next" rel="next" title="右值引用和完美转发">Next Post<i class="fas fa-angle-right fa-fw"></i></a></div></div>
</div></article></div>
            </main>
            <footer class="footer"><div class="footer-container"><div class="footer-line">由 <a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo 0.86.0">Hugo</a> 强力驱动 | 主题 - <a href="https://github.com/khusika/FeelIt" target="_blank" rel="noopener noreffer" title="FeelIt 1.0.1"><i class="fas fa-hand-holding-heart fa-fw"></i> FeelIt</a>
        </div><div class="footer-line" itemscope itemtype="http://schema.org/CreativeWork"><i class="far fa-copyright fa-fw"></i><span itemprop="copyrightYear">2022</span><span class="author" itemprop="copyrightHolder">&nbsp;<a href="/"></a></span></div>
</div>
</footer>
        </div>

        <div id="fixed-buttons"><a href="#" id="back-to-top" class="fixed-button" title="回到顶部">
                <i class="fas fa-chevron-up fa-fw"></i>
            </a></div><link rel="stylesheet" href="/lib/fontawesome-free/all.min.css"><link rel="stylesheet" href="/lib/animate/animate.min.css"><link rel="stylesheet" href="/lib/katex/katex.min.css"><link rel="stylesheet" href="/lib/katex/copy-tex.min.css"><script src="/lib/autocomplete/autocomplete.min.js"></script><script src="/lib/lunr/lunr.min.js"></script><script src="/lib/lunr/lunr.stemmer.support.min.js"></script><script src="/lib/lunr/lunr.zh.min.js"></script><script src="/lib/lazysizes/lazysizes.min.js"></script><script src="/lib/clipboard/clipboard.min.js"></script><script src="/lib/sharer/sharer.min.js"></script><script src="/lib/katex/katex.min.js"></script><script src="/lib/katex/auto-render.min.js"></script><script src="/lib/katex/copy-tex.min.js"></script><script src="/lib/katex/mhchem.min.js"></script><script>window.config={"code":{"copyTitle":"复制到剪贴板","maxShownLines":200},"comment":{},"math":{"delimiters":[{"display":true,"left":"$$","right":"$$"},{"display":true,"left":"\\[","right":"\\]"},{"display":false,"left":"$","right":"$"},{"display":false,"left":"\\(","right":"\\)"}],"strict":false},"search":{"highlightTag":"em","lunrIndexURL":"/index.json","lunrLanguageCode":"zh","lunrSegmentitURL":"/lib/lunr/lunr.segmentit.js","maxResultLength":100,"noResultsFound":"没有找到结果","snippetLength":50,"type":"lunr"}};</script><script src="/js/theme.min.js"></script></body></html>
